<template>
  <div class="home">
    <div class="banner">
      <div class="banxin">
        <img src="../assets/images/home/banner.png" alt="" />
      </div>
    </div>

    <div class="products_in">
      <Title :src="Recommend" title="精品推荐" />
      <Recommend :src="records" />
      <Title :src="hot" title="热门兑换" />
      <div class="banxin">
        <img src="../assets/images/home/ad.png" alt="">
      </div>
      <Hot :src="hotrecords" />
    </div>

    <div class="jifen_in">
      <Title :src="integral" title="积分攻略" />
      <Integral />
    </div>
    
  </div>
</template>

<script>
import Title from "@/components/home/Title.vue";
import Recommend from "@/components/home/Recommend.vue";
import Hot from "@/components/home/Hot.vue";
import {JingpinApi, HotApi} from "@/request/api";
import Integral from "@/components/home/Integral.vue";

export default {
  data() {
    return {
      Recommend: require("../assets/images/home/Recommend.png"),
      hot: require("../assets/images/home/hot.png"),
      integral: require("../assets/images/home/integral.png"),
      // 精品推荐数据数组
      records:[],
      // 热门兑换数据数组
      hotrecords:[],
    };
  },
  components: {
    Title,
    Recommend,
    Hot,
    Integral,
  },
  created(){
    // 精品推荐数据接口
    JingpinApi().then((res) => {
      // console.log(res.data.data.data.records);
      this.records = res.data.data.data.records;
    }) 
    // 热门兑换数据接口
    HotApi().then((res) => {
      // console.log(res.data.data.data.records);
      this.hotrecords = res.data.data.data.records;
    })
  }
};
</script>
 
<style lang = "less" scoped>
@import "../assets/base.less";
.banner {
  width: 100%;
  background: #fff;
  padding-bottom: 30px;
  img {
    display: block;
  }
}
.products_in {
  width: 100%;
  background: #F5F5F5;
  img {
    display: block;
  }
}

</style>